﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using CourseSystem.Core.BLL;

namespace CourseSystem.Common.Helpers
{
    public class TeacherHelper
    {
        public static List<SelectListItem> GetTeacher(bool needDef = true)
        {
            var list = TeacherBLL.GetAllTeacher();
            var re = list.Select(item => new SelectListItem { Value = item.Id.ToString(), Text = item.Name }).ToList();
            if (needDef)
                re.Insert(0, new SelectListItem { Text = "请选择", Value = "0" });
            return re;
        }

        /*<select id="Type" name="Type">
            <option value="0">管理员</option>
            <option value="1">负责教师</option>
            <option value="2">主讲教师</option>
            <option value="3">助教</option>
        </select>*/
        public static List<SelectListItem> GetTeaType()
        {
            var re = new List<SelectListItem>();
            re.Add(new SelectListItem { Text = "管理员", Value = "0" });
            re.Add(new SelectListItem { Text = "负责教师", Value = "1" });
            re.Add(new SelectListItem { Text = "主讲教师", Value = "2" });
            re.Add(new SelectListItem { Text = "助教", Value = "3" });
            re.Add(new SelectListItem { Text = "专家", Value = "4" });
            return re;
        }

        public static string GetTypeChs(int type)
        {
            switch (type)
            {
                case 0:
                    return "管理员"; break;
                case 1:
                    return "负责教师"; break;
                case 2:
                    return "主讲教师"; break;
                case 3:
                    return "助教"; break;
                case 4:
                    return "专家"; break;

            }
            return "";
        }
    }
}
